package top.wilsonlv.jaguar.security.model;

import lombok.Data;
import org.springframework.security.core.GrantedAuthority;

import java.util.Objects;

/**
 * @author lvws
 * @since 2021/7/1
 */
@Data
public class SecurityAuthority implements GrantedAuthority {

    public static final long serialVersionUID = 2L;

    private String authority;

    public SecurityAuthority() {
    }

    public SecurityAuthority(String authority) {
        this.authority = authority;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        SecurityAuthority that = (SecurityAuthority) o;
        return Objects.equals(authority, that.authority);
    }

    @Override
    public int hashCode() {
        return Objects.hash(authority);
    }
}
